<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition  xmlns="http://www.w3.org/1999/xhtml"  
                 xmlns:h="http://java.sun.com/jsf/html"  
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:p="http://primefaces.prime.com.tr/ui"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 template="templates/StakeholderPortalTemplateUnauthenticated.xhtml">

    <link href="./../resources/css/default.css" rel="stylesheet" type="text/css" />
    <link href="./../resources/css/tableLayout.css" rel="stylesheet" type="text/css" />

    <h:head>
        <title>#{bundle['login.stakeholder.title']}</title>
    </h:head>
    
    <ui:define name="localization">
            <p:ajax update="panel
                            stakeholderLoginUsernameLabel
                            stakeholderLoginPasswordLabel
                            rememberchkbox
                            remember
                            forgotPasswordLink
                            stakeholderSignUpLink
                            loginLoginButton" 
                    listener="#{indexManagedBean.selectedLocaleValueChangeListener}" />
    </ui:define>

    <ui:define name="loginContent">

        <!-- panel for dividing web page into sections -->
        <p:panel id="panel" header="#{bundle['login.stakeholder.panel']}" style="margin-bottom:10px;">  
            <p:messages id="statusMessages"/>

            <h:panelGrid columns="3">
                <h:outputText id="stakeholderLoginUsernameLabel" value ="#{bundle['login.stakeholder.username.label']}" />
                <p:inputText id="username" required ="true" label="username" requiredMessage="#{bundle['login.stakeholder.username.required']}" value="#{stakeholderLoginManagedBean.username}" />
                <p:message for="username"/>

                <h:outputLabel id="stakeholderLoginPasswordLabel" value="#{bundle['login.stakeholder.password.label']}" />
                <h:inputSecret id="password" redisplay="true" required="true" label="password" requiredMessage="#{bundle['login.stakeholder.password.required']}" value="#{stakeholderLoginManagedBean.password}" />
                <p:message for="password"/>
            </h:panelGrid>

            <!-- Removed Required password and username. because the command button wont work.-->

            <br></br>
            <h:panelGrid columns="2">
                <h:selectBooleanCheckbox id="rememberchkbox" value="#{stakeholderLoginManagedBean.remember}"/> 
                <h:outputLabel id="remember" value="#{bundle['rememberme.label']}"/>
            </h:panelGrid>
            <br></br>
            <h:panelGrid columns="2">
                <h:commandLink id="forgotPasswordLink" immediate="true" value ="#{bundle['forgotpassword.label']}" action="#{pageRedirectorBean.goStakeholderForgotPassword}"/>
                &nbsp;
                <h:commandLink id="stakeholderSignUpLink" immediate="true" action="#{pageRedirectorBean.goStakeholderRegisterPage}" value="#{bundle['login.stakeholder.signup.label']}"/>
            </h:panelGrid>


            <p:ajaxStatus style="width:16px;height:16px;">
                <f:facet name="start">
                    <h:graphicImage value="/images/ajaxloading.gif" />
                </f:facet>
                <f:facet name="complete">
                    <h:outputText value="" />
                </f:facet>
            </p:ajaxStatus>

            <p:commandButton id="loginLoginButton" value="#{bundle['login.login.button']}" update="statusMessages panel" ajax="true" actionListener="#{stakeholderLoginManagedBean.doLogin}"/>
        </p:panel>
    </ui:define>
</ui:composition>

